<!-- $Id：course filter Author:liuricheng Time:2013-11-06   $ -->
<div  class="search_panel" style="border:1px solid #cad9ea; background:#F4FAFB; margin-bottom:10px;">
	<div style="margin-bottom:5px;">
		<form id="searchForm" action="javascript:searchGoods()" name="searchForm" method="get">
			<img src="__PUBLIC__/image/admin/bg_search.gif" width="26" height="22" border="0" alt="SEARCH">
			<!-- 分类 -->
			<select id="cat_id_filter" name="cat_id">
				<option value="">所有分类</option>
				<volist name="course_categoryList" id="course_category">
					<option value="{$course_category.id}">{$course_category.name}</option>
				</volist>	    	
			</select>
			<!-- 推荐 -->
			<select id="intro_type_filter" name="intro_type">
				<option value="">全部</option>
				<option value="is_new">最新</option>
				<option value="is_hot">最热门(推荐)</option>
			</select>
			<!-- 下架  -->
			<select id="show_filter" name="invalid">
				<option value="all">全部</option>
				<option value="0">上架</option>
				<option value="1">下架</option>
			</select>
			<!-- 排序  -->
			<select id="sort_filter" name="sort">
				<option value="">排序</option>
				<option value="ctime asc">创建时间↑</option>
				<option value="ctime desc">创建时间↓</option>
				<option value="sort asc">排序编号↑</option>
				<option value="sort desc">排序编号↓</option>
			</select>
			<!-- 关键字 -->
			  关键字
			<input id="keyword_filter" type="text" name="keyword" size="15">
			<input type="submit" value=" 搜索 ">
		 </form>
	</div>
</div>

<script type="text/javascript">
	//ajax 请求数据
	function searchGoods(){
		var searchForm	=	document.getElementById('searchForm');
		var datas		=	{};
		
		var cat_id_filter		=	$('#cat_id_filter');
		var intro_type_filter	=	$('#intro_type_filter');
		var keyword_filter		=	$('#keyword_filter');		
		var show_filter			=	$('#show_filter');		
		var sort_filter			=	$('#sort_filter');		
		//构造条件
		if(cat_id_filter.val() != ''){
			datas[cat_id_filter.attr('name')]		=	parseInt(cat_id_filter.val());
		}		
		if(intro_type_filter.val() != ''){
			datas[intro_type_filter.attr('name')]	=	intro_type_filter.val();
		}		
		if(keyword_filter.val() != ''){
			datas[keyword_filter.attr('name')]		=	keyword_filter.val();
		}
		if(show_filter.val() != ''){
			datas[show_filter.attr('name')]			=	show_filter.val();
		}
		if(sort_filter.val() != ''){
			datas[sort_filter.attr('name')]			=	sort_filter.val();
		}
		//ajax请求		
		$.ajax({
			url: "__URL__/course",
			dataType: "html",
			type: "get",
			cache: false,
			async:true,
			data:datas,
			success: function(html){
				$("#content").html(html);
				return false;
			}
		});
	}
	
</script>
